<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <title>Docker容器列表</title>
    <jsp:include page="common/common_head.jsp"></jsp:include>


</head>
<body data-spy="scroll" data-target=".navbar">


<jsp:include page="common/common_banner_app.jsp"></jsp:include>
<div style="height:30px"></div>
<div class="container">

    <div class="dropdown">
        <button class="btn btn-default dropdown-toggle" type="button" id="dropdownMenu1" data-toggle="dropdown" aria-expanded="true">
            容器过滤
            <span class="caret"></span>
        </button>
        <ul class="dropdown-menu" role="menu" aria-labelledby="dropdownMenu1">
            <li role="presentation"><a role="menuitem" tabindex="-1" href="/docker/containers.html?slaves=${slaves}&status=all">所有</a></li>
            <li role="presentation"><a role="menuitem" tabindex="-1" href="/docker/containers.html?slaves=${slaves}&status=running">运行中</a></li>
            <li role="presentation"><a role="menuitem" tabindex="-1" href="/docker/containers.html?slaves=${slaves}&status=exited">正常停止</a></li>
            <li role="presentation"><a role="menuitem" tabindex="-1" href="/docker/containers.html?slaves=${slaves}&status=exception">异常停止</a></li>
        </ul>
    </div>


    <table class="table  table-striped table-bordered table-hover " id="showTable">

        <thead>
        <tr>
            <th>序号</th>
            <th>容器id</th>
            <th>容器名称</th>
            <th>运行状态</th>
            <th>来源镜像</th>
            <th>ip</th>
            <th>操作</th>
        </tr>
        </thead>
        <tbody>
        <c:forEach items="${containers}" var="c" varStatus="v">
            <tr>
                <td>${v.index + 1}</td>
                <td><a href="">${c.id}</a></td>
                <td>${c.names}</td>
                <td>${c.status}</td>
                <td>${c.image}</td>
                <td>${c.ip}</td>
                <td>
                    <button <c:if test="${c.status ne 'running' }">
                        class="btn btn-lg btn-primary"
                        onclick="location.href='/docker/container/start.html?hostName=${slaves}&id=${c.id}'"
                    </c:if>
                            <c:if test="${c.status eq 'running' }">
                                disabled="disabled"
                            </c:if> >
                        启动
                    </button>
                    <button <c:if test="${c.status eq 'running' }">
                        class="btn btn-danger btn-lg"
                        onclick="location.href='/docker/container/stop.html?hostName=${slaves}&id=${c.id}'"
                    </c:if>
                            <c:if test="${c.status eq 'exited' or c.status eq 'exception' }">
                                disabled="disabled"
                            </c:if> >
                        停止
                    </button>
                    <a class="btn" href="/docker/container_ip_configure.html?containerId=${c.id}&name=${c.names}&slaves=${slaves}">指定ip</a>
                </td>
            </tr>
        </c:forEach>

        </tbody>

    </table>

    <jsp:include page="common/common_js.jsp"></jsp:include>


    <script>


    </script>
</body>
</html>